package com.fita.admin.service.coupon;


import com.demo2do.core.entity.page.Page;
import com.fita.admin.entity.content.CouponBatchSearch;
import com.fita.admin.entity.content.CouponTemplateSearch;
import com.fita.admin.entity.content.CouponUseSearch;
import com.fita.admin.service.DataService;
import com.fita.entity.coupon.Coupon;
import com.fita.entity.coupon.CouponBatch;
import com.fita.entity.coupon.CouponTemplate;
import com.fita.entity.coupon.ExpireType;
import com.fita.entity.order.Order;

import java.math.BigDecimal;
import java.util.List;


/**
 * @author LZJ
 * @param <T> 
 *
 */
public interface CouponService<T> extends DataService<T> {
    
    /**
     * List all coupon templates with page
     * 
     * @param page
     * @return
     */
    public List<CouponTemplate> listCouponTemplates(Page page);
    
    /**
     * List all coupon batches with page
     * 
     * @param page
     * @return
     */
    public List<CouponBatch> listCouponBatches(Page page);
    
    /**
     * List all coupons by coupon batch with page
     * 
     * @param couponBatch
     * @param page
     * @return
     */
    public List<Coupon> listCoupons(CouponBatch couponBatch, Page page);
    
    /**
     * search coupon templates by page
     * 
     * @param couponTemplateSearch
     * @param page
     * @return
     */
    public List<CouponTemplate> searchCouponTemplate(CouponTemplateSearch couponTemplateSearch, Page page);
    
    /**
     * search coupon batches by page
     * 
     * @param couponBatchSearch
     * @param page
     * @return
     */
    public List<CouponBatch> searchCouponBatch(CouponBatchSearch couponBatchSearch, Page page);

    /**
     *
     * @param couponUseSearch
     * @param page
     * @return
     */
    public List<Coupon> searchCouponUse(CouponUseSearch couponUseSearch, Page page);

    /**
     * create coupon template
     * 
     * @param couponTemplate
     * @param inputAmount
     * @param inputMinAmount
     */
    public void createCouponTemplate(CouponTemplate couponTemplate, BigDecimal inputAmount, BigDecimal inputMinAmount);
    
    /**
     * create coupon batch
     * 
     * @param couponBatch
     */
    public void createCouponBatch(CouponBatch couponBatch);

    /**
     * edit coupon template
     * 
     * @param couponTemplate
     * @param inputName
     * @param inputAmount
     * @param inputMinAmount
     */
    public void editCouponTemplate(CouponTemplate couponTemplate, String inputName, BigDecimal inputAmount, BigDecimal inputMinAmount);
    
    /**
     * 
     * @param couponBatch
     * @param inputExpireType
     */
    public void ediCouponBatch(CouponBatch couponBatch, ExpireType inputExpireType);
    
    /**
     * 
     * @param couponBatch
     */
    public void generateCoupon(CouponBatch couponBatch);
    
    /**
     * 
     * @param couponTemplate
     * @param description
     */
    public void editCouponTemplateDescription(CouponTemplate couponTemplate, String description);
    
    /**
     * 
     * @param couponBatch
     * @return
     */
	public int countCoupon(CouponBatch couponBatch);
	
	/**
	 * 
	 * @param templateId
	 * @return
	 */
	public CouponTemplate loadTemplate(Long templateId);
	
	/**
	 * 
	 * @param couponId
	 * @return
	 */
	public Coupon loadCoupon(Long couponId);
	/**
	 * 
	 * @param code
	 * @return
	 */
	public Coupon loadCoupon(String code);
	
    /**
     * 
     * @param coupon
     * @param identification
     */
    public void identify(Coupon coupon, String identification);
    
    /**
     * LZJ
     * @param coupon
     */
    public void useCoupon(Coupon coupon);

    /**
     * LZJ
     * @param orderId
     */
    public void useCoupon(Long orderId);
    
    /**
     * LZJ
     * @param order
     */
    public void resetCoupon(Order order);

    /**
     * LZJ
     * @return
     */
    public List <Coupon> listAllUseCoupons(Page page);



}
